<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/private_chat_new.css?v={:config('other.ui_version')}" media="all">
    <style>
        .chat_right {
            width: 100%;
            margin-left: 0px;
        }
    </style>
    <script>
        var user_id = 0;
        var session_id;
    </script>
</head>

<body>
    <input id="specialAnchorIds" value="{$specialAnchorIds}" style="display: none;">
    <input id="privateChatUploadApi" value="{$privateChatUploadApi}" style="display: none;">
    {if $specialAnchorsCount > 0}
    <div class="chat-tab">
        {volist name='specialAnchors' id='item'}
        <div class="chat-tab-btn" data-topanchorid="{$item.id}" id="top_{$item.id}"><span>{$item.nick_name}</span>
            {if $item.unread > 0}
            <span class="chat-tab-btn-note" id="top_unread_{$item.id}"
                data-topunread="{$item.unread}">{$item.unread}</span>
            {/if}
        </div>
        {/volist}
    </div>
    {/if}

    <div class="chat-tab">
        {volist name='anchors' id='item'}
        <div class="chat-tab-btn" data-topanchorid="{$item.id}" id="top_{$item.id}"><span>{$item.nick_name}</span>
            {if $item.unread > 0}
            <span class="chat-tab-btn-note" id="top_unread_{$item.id}"
                data-topunread="{$item.unread}">{$item.unread}</span>
            {/if}
        </div>
        {/volist}
    </div>

    <div class="chat_right">
        <div class="chat_session">
            <div class="session_area">
                <div class="chat_list chatList inTalk">
                </div>
            </div>

            <!--聊天内容区域-->
            {include file='privatechat/send_chat'}
            <div style="position: relative; left:-80px; top:10px; z-index: 999;height: 30px;">
                <button id="ban-btn" style="display:none" onclick="private_chat_ban(user_id, session_id)"
                    class="layui-btn layui-btn-xs layui-btn-danger">禁言</button>
            </div>

        </div>
    </div>

    <script src="/layuiadmin/layui/layui.2.6.8.js"></script>
    <script src="/static/jquery.min.js"></script>
    <script src="/layuiadmin/modules/talk.js?v={:config('other.ui_version')}"></script>
    <script>
        layui.config({
            base: '/layuiadmin/' //静态资源所在路径
            , version: "{:config('other.ui_version')}"
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'privatechat', 'form'], function () {
            var $ = layui.$;

            // 获取直播私聊列表

            // 5秒更新一次聊天
            // setInterval(function () {
            //     getSessionList();
            // }, 3000);


        });

        function private_chat_ban(user_id) {
            $.ajax({
                url: '/admin/privatechat/private_chat_ban',
                type: 'get',
                data: { "user_id": user_id },
                dataType: 'json',
                success: function (res) {
                    layer.msg('操作成功');
                    layer.closeAll('loading');
                    $("#ban-btn").html(res.data.btn)
                    $("#" + session_id).attr("data-ban", res.data.ban)
                },
                error: function (err) {
                    layer.msg('系统异常,请稍后再试!');
                },
                complete: function () {
                    layer.closeAll('loading');
                }
            });
        }
    </script>
</body>

</html>